package com.ufind.server.infra.repository;

import com.ufind.server.core.repository.IUserRepository;
import com.ufind.server.facade.dto.base.BaseEntity;
import com.ufind.server.infra.repository.sql.UserMapper;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;

@Named
public class UserRepository implements IUserRepository {

    @Inject
    private UserMapper userMapper;

    /**
     * 测试接口继承的方式的正确性
     * @param entity
     * @param <T>
     * @return
     */
    public <T extends BaseEntity> int insertSelective(T entity) {
        userMapper.insertSelective(entity);
        return Integer.parseInt(entity.getId() + ""); //返回插入数据的id
    }

    /////////////////////////////////////////

    public int deleteByPrimaryKey(String entityId) {
        return 0;
    }

    public <T extends BaseEntity> int insert(T entity) {
        return 0;
    }

    public <T extends BaseEntity> T selectByPrimaryKey(String entityId) {
        return null;
    }

    public <T extends BaseEntity> int updateByPrimaryKeySelective(T entity) {
        return 0;
    }

    public <T extends BaseEntity> int updateByPrimaryKey(T entity) {
        return 0;
    }

    public <T extends BaseEntity> boolean exists(String entityId) {
        return false;
    }

    public <T extends BaseEntity> List<T> findAll() {
        return null;
    }
}
